// Author: wsfuyibing <682805@qq.com>
// Date: 2025-05-01

package user

import (
	"gitee.com/go-wares/framework-iris/framework"
	"gitee.com/go-wares/framework-iris/framework/src/logics"
	"github.com/kataras/iris/v12"
	"server/app/http/logics/user/encryption/qrcode"
	"server/app/http/logics/user/history/login"
	"server/app/http/logics/user/profile"
	"server/app/http/logics/user/update/avatar"
	"server/app/http/logics/user/update/gender"
	"server/app/http/logics/user/update/mobile"
	"server/app/http/logics/user/update/mobile_verify"
	"server/app/http/logics/user/update/nickname"
)

// Controller
// 用户接口.
//
// @RoutePrefix("/user")
// @Middleware("authorizer")
type Controller struct{}

// GetEncryptionQrcode
// 二维码密码串.
//
// 生成适用于用户的二维码加密串.
//
// @Get("/encryption/qrcode")
func (o *Controller) GetEncryptionQrcode(i iris.Context) {
	framework.Do(i, qrcode.New)
}

// GetHistoryLogin
// 登录历史.
func (o *Controller) GetHistoryLogin(i iris.Context) {
	framework.Do(i, login.New)
}

// GetProfile
// 用户资料.
//
// @Get("/profile")
func (o *Controller) GetProfile(i iris.Context) {
	framework.Do(i, profile.New)
}

// PostUpdateAvatar
// 修改头像.
func (o *Controller) PostUpdateAvatar(i iris.Context) {
	framework.Do(i, avatar.New)
}

// PostUpdateGender
// 修改性别.
func (o *Controller) PostUpdateGender(i iris.Context) {
	framework.Do(i, gender.New)
}

// PostUpdateMobile
// 修改手机号.
func (o *Controller) PostUpdateMobile(i iris.Context) {
	logics.Do(i, mobile.New)
}

// PostUpdateMobileVerify
// 校验原手机号.
func (o *Controller) PostUpdateMobileVerify(i iris.Context) {
	logics.Do(i, mobile_verify.New)
}

// PostUpdateNickname
// 修改昵称.
func (o *Controller) PostUpdateNickname(i iris.Context) {
	framework.Do(i, nickname.New)
}
